package com.battle.service.controller.web;

import com.battle.pojo.param.userCooperation.*;
import com.battle.pojo.vo.caseAlarmPanel.GetCaseAlarmPanelVo;
import com.battle.pojo.vo.userCooperation.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
 * web/用户协作
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 */
@RestController
@RequestMapping("/userCooperation/web")
public class UserCooperationWebController {

    private final UserCooperationService service;

    public UserCooperationWebController(UserCooperationService service) {
        this.service = service;
    }


    /**
     * 创建用户协作
     *
     * @param param
     * @return
     */
    @PostMapping("/createUserCooperation")
    public ApiResult createUserCooperation(@RequestBody @Valid CreateUserCooperationParam param) {
        service.createUserCooperation(param);
        return ApiResult.ok();
    }

    /**
     * 获取用户协作详情
     * @param id
     * @return
     */
    @GetMapping("/getUserCooperation")
    public ApiResult<GetUserCooperationVo> getUserCooperation(@RequestParam("id") Long id){
        GetUserCooperationVo vo = service.getUserCooperation(id);
        return ApiResult.ok(vo);
    }

    /**
     * 修改用户协作
     *
     * @param param
     */
    @PutMapping("/editUserCooperation")
    public ApiResult editUserCooperation(@RequestBody @Valid EditUserCooperationParam param) {
        service.editUserCooperation(param);
        return ApiResult.ok();
    }

    /**
     * 获取用户协作列表
     *
     * @param param
     * @return
     */
    @PostMapping("/getUserCooperationList")
    public ApiResult<PageResult<GetUserCooperationListVo>> getUserCooperationList(@RequestBody GetUserCooperationListParam param) {
        PageResult<GetUserCooperationListVo> result = service.getUserCooperationList(param);
        return ApiResult.ok(result);
    }


}

